<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Blog,Hexo," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="主题样式优化修改打赏字体不闪动修改文件next/source/css/_common/components/post/post-reward.styl，然后注释其中的函数wechat:hover和alipay:hover，如下：123456789101112/* 注释文字闪动函数 #wechat:hover p&amp;#123;    animation: roll 0.1s infinite line">
<meta property="og:type" content="article">
<meta property="og:title" content="Hexo Next主题设置和优化">
<meta property="og:url" content="http://www.vitah.net/posts/20f300cc/index.html">
<meta property="og:site_name" content="Vitah's Blog">
<meta property="og:description" content="主题样式优化修改打赏字体不闪动修改文件next/source/css/_common/components/post/post-reward.styl，然后注释其中的函数wechat:hover和alipay:hover，如下：123456789101112/* 注释文字闪动函数 #wechat:hover p&amp;#123;    animation: roll 0.1s infinite line">
<meta property="og:image" content="http://oc1mf55gf.bkt.clouddn.com/A0692BE3-87BE-4BFC-9C7F-5152B62B17EB.png">
<meta property="og:updated_time" content="2016-04-11T07:08:33.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Hexo Next主题设置和优化">
<meta name="twitter:description" content="主题样式优化修改打赏字体不闪动修改文件next/source/css/_common/components/post/post-reward.styl，然后注释其中的函数wechat:hover和alipay:hover，如下：123456789101112/* 注释文字闪动函数 #wechat:hover p&amp;#123;    animation: roll 0.1s infinite line">
<meta name="twitter:image" content="http://oc1mf55gf.bkt.clouddn.com/A0692BE3-87BE-4BFC-9C7F-5152B62B17EB.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://www.vitah.net/posts/20f300cc/"/>





  <title> Hexo Next主题设置和优化 | Vitah's Blog </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  














  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Vitah's Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocapitalize="off" autocomplete="off" autocorrect="off"
             placeholder="搜索..." spellcheck="false"
             type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://www.vitah.net/posts/20f300cc/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Vitah">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/head.JPG">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Vitah's Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                Hexo Next主题设置和优化
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2016-12-03T13:09:33+08:00">
                2016-12-03
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Blog/" itemprop="url" rel="index">
                    <span itemprop="name">Blog</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/posts/20f300cc/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count disqus-comment-count"
                        data-disqus-identifier="posts/20f300cc/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h3 id="主题样式优化"><a href="#主题样式优化" class="headerlink" title="主题样式优化"></a>主题样式优化</h3><h4 id="修改打赏字体不闪动"><a href="#修改打赏字体不闪动" class="headerlink" title="修改打赏字体不闪动"></a>修改打赏字体不闪动</h4><p>修改文件<code>next/source/css/_common/components/post/post-reward.styl</code>，然后注释其中的函数<code>wechat:hover</code>和<code>alipay:hover</code>，如下：<br><figure class="highlight css"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line"><span class="comment">/* 注释文字闪动函数</span></div><div class="line"> #wechat:hover p&#123;</div><div class="line">    animation: roll 0.1s infinite linear;</div><div class="line">    -webkit-animation: roll 0.1s infinite linear;</div><div class="line">    -moz-animation: roll 0.1s infinite linear;</div><div class="line">&#125;</div><div class="line"> #alipay:hover p&#123;</div><div class="line">   animation: roll 0.1s infinite linear;</div><div class="line">    -webkit-animation: roll 0.1s infinite linear;</div><div class="line">    -moz-animation: roll 0.1s infinite linear;</div><div class="line">&#125;</div><div class="line">*/</div></pre></td></tr></table></figure></p>
<h4 id="采用多说时文章评论数目不显示"><a href="#采用多说时文章评论数目不显示" class="headerlink" title="采用多说时文章评论数目不显示"></a>采用多说时文章评论数目不显示</h4><p>当采用多说评论系统的时候，不知道因为什么原因，文章的评论数目不能正常显示，显示效果如下，分类后面不能正常显示评论数目，但有分隔号：<br><img src="http://oc1mf55gf.bkt.clouddn.com/A0692BE3-87BE-4BFC-9C7F-5152B62B17EB.png" alt=""></p>
<p>修改文件<code>themes\next\source\css\_common\components\post\post-meta.styl</code>，将原来的代码：<br><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">.posts-expand .post-comments-count &#123;</div><div class="line">  +mobile() &#123; display: none; &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>改为：<br><figure class="highlight css"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line"><span class="selector-class">.posts-expand</span> <span class="selector-class">.post-comments-count</span> &#123;</div><div class="line">  <span class="attribute">display</span>: none; </div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>使文章始终不显示评论数目，而不仅仅在手机模式下。</p>
<a id="more"></a>
<h4 id="修改内链文字样式"><a href="#修改内链文字样式" class="headerlink" title="修改内链文字样式"></a>修改内链文字样式</h4><p>原来版本的内链样式跟默认的字体很类似，这里进行修改。将链接文本设置为蓝色，鼠标划过时文字颜色加深，并显示下划线。修改文件<code>themes\next\source\css\_common\components\post\post.styl</code>，添加如下css样式：<br><figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">.post-body p a&#123;</div><div class="line">  color: #<span class="number">0593</span>d3;</div><div class="line">  border-bottom: none;</div><div class="line"></div><div class="line">  &amp;:hover &#123;</div><div class="line">    color: #<span class="number">0477</span>ab;</div><div class="line">    text-decoration: underline;</div><div class="line">  &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>选择<code>.post-body</code>是为了不影响标题，选择<code>p</code>是为了不影响首页“阅读全文”的显示样式。</p>
<p>参考链接</p>
<ul>
<li><a href="http://www.wuxubj.cn/2016/08/Hexo-nexT-build-personal-blog/" target="_blank" rel="external">http://www.wuxubj.cn/2016/08/Hexo-nexT-build-personal-blog/</a></li>
</ul>
<h4 id="修改小段的代码样式"><a href="#修改小段的代码样式" class="headerlink" title="修改小段的代码样式"></a>修改小段的代码样式</h4><p>主题原来的小段代码样式跟默认文章字体有点类似，这里可以修改其样式显示的更清晰点。<br>修改文件<code>themes\next\source\css\_common\components\hightlight\hightlight.style</code>文件，找到其中的<code>code</code>段代码，改为如下形式：<br><figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">code &#123;</div><div class="line">  padding: <span class="number">2</span>px <span class="number">6</span>px;</div><div class="line">  word-wrap: <span class="keyword">break</span>-word;</div><div class="line">  color: $highlight-red;</div><div class="line">  background: #f9f2f4;</div><div class="line">  border-rdius: $code-border-radius;</div><div class="line">  font-size $code-font-size+<span class="number">1</span>;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>其中的<code>color</code>就是字体对应的颜色，<code>background</code>对应背景颜色。</p>
<h4 id="修改侧边栏头像为圆形"><a href="#修改侧边栏头像为圆形" class="headerlink" title="修改侧边栏头像为圆形"></a>修改侧边栏头像为圆形</h4><p>修改文件<code>themes\next\source\css\_common\components\sidebar\sidebar-author.style</code>，修改其中的<code>.site-author-image</code>段代码，改为如下形式：<br><figure class="highlight css"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line"><span class="selector-class">.site-author-image</span> &#123;</div><div class="line">  <span class="attribute">display</span>: block;</div><div class="line">  <span class="attribute">margin</span>: <span class="number">0</span> auto;</div><div class="line">  <span class="attribute">max-width</span>: <span class="number">96px</span>;</div><div class="line">  <span class="attribute">height</span>: auto;</div><div class="line">  <span class="attribute">border</span>: <span class="number">2px</span> solid <span class="number">#333</span>;</div><div class="line">  <span class="attribute">padding</span>: <span class="number">2px</span>;</div><div class="line">  <span class="attribute">border-radius</span>: <span class="number">50%</span>;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>如果需要添加鼠标停留在上面发生旋转效果，那么添加如下代码：<br><figure class="highlight css"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div></pre></td><td class="code"><pre><div class="line"><span class="selector-class">.site-author-image</span> &#123;</div><div class="line">  <span class="attribute">display</span>: block;</div><div class="line">  <span class="attribute">margin</span>: <span class="number">0</span> auto;</div><div class="line">  <span class="attribute">max-width</span>: <span class="number">96px</span>;</div><div class="line">  <span class="attribute">height</span>: auto;</div><div class="line">  <span class="attribute">border</span>: <span class="number">2px</span> solid <span class="number">#333</span>;</div><div class="line">  <span class="attribute">padding</span>: <span class="number">2px</span>;</div><div class="line"></div><div class="line">  <span class="attribute">border-radius</span>: <span class="number">50%</span></div><div class="line">  webkit-transition: <span class="number">1.4s</span> all;</div><div class="line">  <span class="attribute">moz-transition</span>: <span class="number">1.4s</span> all;</div><div class="line">  <span class="attribute">ms-transition</span>: <span class="number">1.4s</span> all;</div><div class="line">  <span class="attribute">transition</span>: <span class="number">1.4s</span> all;</div><div class="line">&#125;</div><div class="line"></div><div class="line"><span class="selector-class">.site-author-image</span><span class="selector-pseudo">:hover</span> &#123;</div><div class="line">  <span class="attribute">background-color</span>: <span class="number">#55DAE1</span>;</div><div class="line">  <span class="attribute">webkit-transform</span>: <span class="built_in">rotate</span>(360deg) <span class="built_in">scale</span>(1.1);</div><div class="line">  <span class="attribute">moz-transform</span>: <span class="built_in">rotate</span>(360deg) <span class="built_in">scale</span>(1.1);</div><div class="line">  <span class="attribute">ms-transform</span>: <span class="built_in">rotate</span>(360deg) <span class="built_in">scale</span>(1.1);</div><div class="line">  <span class="attribute">transform</span>: <span class="built_in">rotate</span>(360deg) <span class="built_in">scale</span>(1.1);</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>参考链接</p>
<ul>
<li><a href="http://codepub.cn/2016/03/20/Hexo-blog-theme-switching-from-Jacman-to-NexT-Mist/" target="_blank" rel="external">http://codepub.cn/2016/03/20/Hexo-blog-theme-switching-from-Jacman-to-NexT-Mist/</a></li>
</ul>
<h3 id="多说CSS修改"><a href="#多说CSS修改" class="headerlink" title="多说CSS修改"></a>多说CSS修改</h3><h4 id="隐藏评论框底部分享到QQ空间按钮"><a href="#隐藏评论框底部分享到QQ空间按钮" class="headerlink" title="隐藏评论框底部分享到QQ空间按钮"></a>隐藏评论框底部分享到QQ空间按钮</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line"><span class="selector-class">.ds-sync</span>&#123;</div><div class="line">  <span class="attribute">display</span>:none <span class="meta">!important</span>;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h4 id="隐藏底部版权信息"><a href="#隐藏底部版权信息" class="headerlink" title="隐藏底部版权信息"></a>隐藏底部版权信息</h4><figure class="highlight css"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line"><span class="selector-id">#ds-thread</span> <span class="selector-id">#ds-reset</span> <span class="selector-class">.ds-powered-by</span> &#123;</div><div class="line">  <span class="attribute">display</span>: none;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h4 id="参考链接"><a href="#参考链接" class="headerlink" title="参考链接"></a>参考链接</h4><ul>
<li><a href="http://www.360doc.com/content/15/0126/21/21724608_444033903.shtml" target="_blank" rel="external">http://www.360doc.com/content/15/0126/21/21724608_444033903.shtml</a></li>
<li><a href="http://shenchaofei.cn/duoshuo-comment-box-css-custom/328.html" target="_blank" rel="external">http://shenchaofei.cn/duoshuo-comment-box-css-custom/328.html</a></li>
<li><a href="http://dev.duoshuo.com/docs/4ff1cfd0397309552c000017" target="_blank" rel="external">http://dev.duoshuo.com/docs/4ff1cfd0397309552c000017</a></li>
</ul>
<h3 id="搜索功能"><a href="#搜索功能" class="headerlink" title="搜索功能"></a>搜索功能</h3><p>博客的站内搜索网上一般说用<code>Swiftype</code>搜索，尝试了下，但是提示只有一个月的免费试用，遂放弃改用<code>Local Search</code>。</p>
<h4 id="安装hexo-generator-search"><a href="#安装hexo-generator-search" class="headerlink" title="安装hexo-generator-search"></a>安装hexo-generator-search</h4><figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install hexo-generator-search --save</div></pre></td></tr></table></figure>
<h4 id="编辑站点的配置文件，Hexo目录下的-config-yml文件，新增以下内容："><a href="#编辑站点的配置文件，Hexo目录下的-config-yml文件，新增以下内容：" class="headerlink" title="编辑站点的配置文件，Hexo目录下的_config.yml文件，新增以下内容："></a>编辑站点的配置文件，Hexo目录下的_config.yml文件，新增以下内容：</h4><figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">search:</div><div class="line">  path: search.xml</div><div class="line">  field: post</div></pre></td></tr></table></figure>
<h3 id="文章链接唯一化"><a href="#文章链接唯一化" class="headerlink" title="文章链接唯一化"></a>文章链接唯一化</h3><p>也许你会数次更改文章题目或者变更文章发布时间，在默认设置下，文章链接都会改变，不利于搜索引擎收录，也不利于分享。唯一永久链接才是更好的选择。安装此插件后，不要在<code>hexo s</code>模式下更改文章文件名，否则文章将成空白。</p>
<p>安装：<br><figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install hexo-abbrlink --save</div></pre></td></tr></table></figure></p>
<p>在<code>站点配置文件</code>中查找代码<code>permalink</code>，将其更改为:<br><figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">permalink: posts/:abbrlink/  # “posts/” 可自行更换</div></pre></td></tr></table></figure></p>
<p>在<code>站点配置文件</code>中添加如下代码：<br><figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"><span class="meta"># abbrlink config</span></div><div class="line">abbrlink:</div><div class="line">  alg: crc32  # 算法：crc16(<span class="keyword">default</span>) and crc32 </div><div class="line">  rep: hex    # 进制：dec(<span class="keyword">default</span>) and hex</div></pre></td></tr></table></figure></p>
<p>可选择模式：</p>
<ul>
<li>crc16 &amp; hex</li>
<li>crc16 &amp; dec</li>
<li>crc32 &amp; hex</li>
<li>crc32 &amp; dec</li>
</ul>
<h3 id="文章底部增加版权信息"><a href="#文章底部增加版权信息" class="headerlink" title="文章底部增加版权信息"></a>文章底部增加版权信息</h3><p>新版的 <code>Next</code> 主题应该已经支持文章版权的相关设置，在对应的目录下可以看到带有 <code>copyright</code> 相关的代码。</p>
<p>在这里，我们不使用主题本身的版权设置，改用我们自定义的版权信息说明，类似本文下方的表现形式。</p>
<blockquote>
<p><strong>注：类似本文的版权信息，需要增加相关的代码来实现。这个功能不是我自己写的，代码和想法皆出自于务虚笔记（作者博客名称），当初是请教作者并且得到授权允许发布相关文章来说明如何实现类似的样式。作者个人链接是<a href="http://www.wuxubj.cn/" target="_blank" rel="external">http://www.wuxubj.cn/</a>，转载这部分内容请务必注明作者及其个人链接</strong>。<br>作者对于 <code>next</code>主题的优化可以参考 <a href="https://github.com/wuxubj/wuxubj.github.io" target="_blank" rel="external"><code>Github链接</code></a></p>
</blockquote>
<p>在目录 <code>next/layout/_macro/下</code>添加 <code>my-copyright.swig</code>：<br><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div></pre></td><td class="code"><pre><div class="line">&#123;% if page.copyright %&#125;</div><div class="line">&lt;div class="my_post_copyright"&gt;</div><div class="line">  &lt;script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"&gt;&lt;/script&gt;</div><div class="line">  </div><div class="line">  &lt;!-- JS库 sweetalert 可修改路径 --&gt;</div><div class="line">  &lt;script type="text/javascript" src="http://jslibs.wuxubj.cn/sweetalert_mini/jquery-1.7.1.min.js"&gt;&lt;/script&gt;</div><div class="line">  &lt;script src="http://jslibs.wuxubj.cn/sweetalert_mini/sweetalert.min.js"&gt;&lt;/script&gt;</div><div class="line">  &lt;link rel="stylesheet" type="text/css" href="http://jslibs.wuxubj.cn/sweetalert_mini/sweetalert.mini.css"&gt;</div><div class="line"></div><div class="line">  &lt;p&gt;&lt;span&gt;本文标题:&lt;/span&gt;&lt;a href="&#123;&#123; url_for(page.path) &#125;&#125;"&gt;&#123;&#123; page.title &#125;&#125;&lt;/a&gt;&lt;/p&gt;</div><div class="line">  &lt;p&gt;&lt;span&gt;文章作者:&lt;/span&gt;&lt;a href="/" title="访问 &#123;&#123; theme.author &#125;&#125; 的个人博客"&gt;&#123;&#123; theme.author &#125;&#125;&lt;/a&gt;&lt;/p&gt;</div><div class="line">  &lt;p&gt;&lt;span&gt;发布时间:&lt;/span&gt;&#123;&#123; page.date.format("YYYY年MM月DD日 - HH:MM") &#125;&#125;&lt;/p&gt;</div><div class="line">  &lt;p&gt;&lt;span&gt;最后更新:&lt;/span&gt;&#123;&#123; page.updated.format("YYYY年MM月DD日 - HH:MM") &#125;&#125;&lt;/p&gt;</div><div class="line">  &lt;p&gt;&lt;span&gt;原始链接:&lt;/span&gt;&lt;a href="&#123;&#123; url_for(page.path) &#125;&#125;" title="&#123;&#123; page.title &#125;&#125;"&gt;&#123;&#123; page.permalink &#125;&#125;&lt;/a&gt;</div><div class="line">    &lt;span class="copy-path"  title="点击复制文章链接"&gt;&lt;i class="fa fa-clipboard" data-clipboard-text="&#123;&#123; page.permalink &#125;&#125;"  aria-label="复制成功！"&gt;&lt;/i&gt;&lt;/span&gt;</div><div class="line">  &lt;/p&gt;</div><div class="line">  &lt;p&gt;&lt;span&gt;许可协议:&lt;/span&gt;&lt;i class="fa fa-creative-commons"&gt;&lt;/i&gt; &lt;a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)"&gt;署名-非商业性使用-禁止演绎 4.0 国际&lt;/a&gt; 转载请保留原文链接及作者。&lt;/p&gt;  </div><div class="line">&lt;/div&gt;</div><div class="line"></div><div class="line">&lt;script&gt; </div><div class="line">    var clipboard = new Clipboard('.fa-clipboard');</div><div class="line">	clipboard.on('success', $(function()&#123;</div><div class="line">	  $(".fa-clipboard").click(function()&#123;</div><div class="line">		swal(&#123;   </div><div class="line">		  title: "",   </div><div class="line">		  text: '复制成功',   </div><div class="line">		  html: false,</div><div class="line">		  timer: 500,   </div><div class="line">		  showConfirmButton: false</div><div class="line">	    &#125;);</div><div class="line">	  &#125;);</div><div class="line">    &#125;));  </div><div class="line">&lt;/script&gt;</div><div class="line">&#123;% endif %&#125;</div></pre></td></tr></table></figure></p>
<p>在目录<code>next/source/css/_common/components/post/</code>下添加<code>my-post-copyright.styl</code>：<br><figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div></pre></td><td class="code"><pre><div class="line">.my_post_copyright &#123;</div><div class="line">  width: <span class="number">85</span>%;</div><div class="line">  max-width: <span class="number">45</span>em;</div><div class="line">  margin: <span class="number">2.8</span>em <span class="keyword">auto</span> <span class="number">0</span>;</div><div class="line">  padding: <span class="number">0.5</span>em <span class="number">1.0</span>em;</div><div class="line">  border: <span class="number">1</span>px solid #d3d3d3;</div><div class="line">  font-size: <span class="number">0.93</span>rem;</div><div class="line">  line-height: <span class="number">1.6</span>em;</div><div class="line">  word-<span class="keyword">break</span>: <span class="keyword">break</span>-all;</div><div class="line">  background: rgba(<span class="number">255</span>,<span class="number">255</span>,<span class="number">255</span>,<span class="number">0.4</span>);</div><div class="line">&#125;</div><div class="line"></div><div class="line">.my_post_copyright p&#123;margin:<span class="number">0</span>;&#125;</div><div class="line"></div><div class="line">.my_post_copyright span &#123;</div><div class="line">  display: <span class="keyword">inline</span>-block;</div><div class="line">  width: <span class="number">5.2</span>em;</div><div class="line">  color: #b5b5b5;</div><div class="line">  font-weight: bold;</div><div class="line">&#125;</div><div class="line"></div><div class="line">.my_post_copyright .raw &#123;</div><div class="line">  margin-left: <span class="number">1</span>em;</div><div class="line">  width: <span class="number">5</span>em;</div><div class="line">&#125;</div><div class="line"></div><div class="line">.my_post_copyright a &#123;</div><div class="line">  color: #<span class="number">808080</span>;</div><div class="line">  border-bottom:<span class="number">0</span>;</div><div class="line">&#125;</div><div class="line"></div><div class="line">.my_post_copyright a:hover &#123;</div><div class="line">  color: #a3d2a3;</div><div class="line">  text-decoration: underline;</div><div class="line">&#125;</div><div class="line"></div><div class="line">.my_post_copyright:hover .fa-clipboard &#123;</div><div class="line">  color: #<span class="number">000</span>;</div><div class="line">&#125;</div><div class="line"></div><div class="line">.my_post_copyright .post-url:hover &#123;</div><div class="line">  font-weight: normal;</div><div class="line">&#125;</div><div class="line"></div><div class="line">.my_post_copyright .copy-path &#123;</div><div class="line">  margin-left: <span class="number">1</span>em;</div><div class="line">  width: <span class="number">1</span>em;</div><div class="line">  +mobile()&#123;display:none;&#125;</div><div class="line">&#125;</div><div class="line"></div><div class="line">.my_post_copyright .copy-path:hover &#123;</div><div class="line">  color: #<span class="number">808080</span>;</div><div class="line">  cursor: pointer;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>修改<code>next/layout/_macro/post.swig</code>，在代码<br><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">&lt;div&gt;</div><div class="line">      &#123;% if not is_index %&#125;</div><div class="line">        &#123;% include 'wechat-subscriber.swig' %&#125;</div><div class="line">      &#123;% endif %&#125;</div><div class="line">&lt;/div&gt;</div></pre></td></tr></table></figure></p>
<p>之前添加增加如下代码：<br><figure class="highlight"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">&lt;div&gt;</div><div class="line">      &#123;% if not is_index %&#125;</div><div class="line">        &#123;% include 'my-copyright.swig' %&#125;</div><div class="line">      &#123;% endif %&#125;</div><div class="line">&lt;/div&gt;</div></pre></td></tr></table></figure></p>
<p>修改<code>next/source/css/_common/components/post/post.styl</code>文件，在最后一行增加代码：<br><figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">@<span class="keyword">import</span> <span class="string">"my-post-copyright"</span></div></pre></td></tr></table></figure></p>
<p>保存重新生成即可。</p>
<p>这样当发布一篇博文是，要在该博文下面增加版权信息的显示，需要在 Markdown 中增加<code>copyright: true</code>的设置，类似<br><figure class="highlight c"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">---</div><div class="line">title: Mac终端翻墙</div><div class="line">tags: Linux&amp;Unix</div><div class="line">categories: Linux&amp;Unix</div><div class="line">comments: <span class="literal">true</span></div><div class="line">abbrlink: <span class="number">745</span>a6d7</div><div class="line">date: <span class="number">2016</span><span class="number">-11</span><span class="number">-24</span> <span class="number">18</span>:<span class="number">26</span>:<span class="number">33</span></div><div class="line">updated: <span class="number">2016</span><span class="number">-11</span><span class="number">-24</span> <span class="number">18</span>:<span class="number">26</span>:<span class="number">33</span></div><div class="line">copyright: <span class="literal">true</span></div><div class="line">---</div></pre></td></tr></table></figure></p>

      
    </div>
    
    <div>
      
        
<div class="my_post_copyright">
  <script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>
  
  <!-- JS库 sweetalert 可修改路径 -->
  <script type="text/javascript" src="http://jslibs.wuxubj.cn/sweetalert_mini/jquery-1.7.1.min.js"></script>
  <script src="http://jslibs.wuxubj.cn/sweetalert_mini/sweetalert.min.js"></script>
  <link rel="stylesheet" type="text/css" href="http://jslibs.wuxubj.cn/sweetalert_mini/sweetalert.mini.css">

  <p><span>本文标题:</span><a href="/posts/20f300cc/">Hexo Next主题设置和优化</a></p>
  <p><span>文章作者:</span><a href="/" title="访问 Vitah 的个人博客">Vitah</a></p>
  <p><span>发布时间:</span>2016年12月03日 - 13:12</p>
  <p><span>最后更新:</span>2016年04月11日 - 15:04</p>
  <p><span>原始链接:</span><a href="/posts/20f300cc/" title="Hexo Next主题设置和优化">http://www.vitah.net/posts/20f300cc/</a>
    <span class="copy-path"  title="点击复制文章链接"><i class="fa fa-clipboard" data-clipboard-text="http://www.vitah.net/posts/20f300cc/"  aria-label="复制成功！"></i></span>
  </p>
  <p><span>许可协议:</span><i class="fa fa-creative-commons"></i> <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
</div>

<script> 
    var clipboard = new Clipboard('.fa-clipboard');
	clipboard.on('success', $(function(){
	  $(".fa-clipboard").click(function(){
		swal({   
		  title: "",   
		  text: '复制成功',   
		  html: false,
		  timer: 500,   
		  showConfirmButton: false
	    });
	  });
    }));  
</script>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        
  <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
    <div></div>
    <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
      <span>赏</span>
    </button>
    <div id="QR" style="display: none;">
      
        <div id="wechat" style="display: inline-block">
          <img id="wechat_qr" src="/images/wechatpay.jpeg" alt="Vitah WeChat Pay"/>
          <p>微信打赏</p>
        </div>
      
      
        <div id="alipay" style="display: inline-block">
          <img id="alipay_qr" src="/images/alipay.jpeg" alt="Vitah Alipay"/>
          <p>支付宝打赏</p>
        </div>
      
    </div>
  </div>


      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Blog/" rel="tag"># Blog</a>
          
            <a href="/tags/Hexo/" rel="tag"># Hexo</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/posts/f04546c5/" rel="next" title="左移位和右移位">
                <i class="fa fa-chevron-left"></i> 左移位和右移位
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/posts/5e0661f6/" rel="prev" title="Chrome插件推荐Octotree">
                Chrome插件推荐Octotree <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="disqus_thread">
        <noscript>
          Please enable JavaScript to view the
          <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
        </noscript>
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/head.JPG"
               alt="Vitah" />
          <p class="site-author-name" itemprop="name">Vitah</p>
           
              <p class="site-description motion-element" itemprop="description">深自缄默，如云漂泊。</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">47</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">13</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">14</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/vitahlin" target="_blank" title="Github">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  Github
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="mailto:linw1225@163.com" target="_blank" title="Mail">
                  
                    <i class="fa fa-fw fa-envelope"></i>
                  
                  Mail
                </a>
              </span>
            
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-block">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              友情链接
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="https://shuge.org/" title="书格" target="_blank">书格</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="https://taozj.org/" title="taozj" target="_blank">taozj</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://oserror.com/" title="Charles" target="_blank">Charles</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.hsmouc.com/" title="Hsmouc" target="_blank">Hsmouc</a>
                </li>
              
            </ul>
          </div>
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#主题样式优化"><span class="nav-number">1.</span> <span class="nav-text">主题样式优化</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#修改打赏字体不闪动"><span class="nav-number">1.1.</span> <span class="nav-text">修改打赏字体不闪动</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#采用多说时文章评论数目不显示"><span class="nav-number">1.2.</span> <span class="nav-text">采用多说时文章评论数目不显示</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#修改内链文字样式"><span class="nav-number">1.3.</span> <span class="nav-text">修改内链文字样式</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#修改小段的代码样式"><span class="nav-number">1.4.</span> <span class="nav-text">修改小段的代码样式</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#修改侧边栏头像为圆形"><span class="nav-number">1.5.</span> <span class="nav-text">修改侧边栏头像为圆形</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#多说CSS修改"><span class="nav-number">2.</span> <span class="nav-text">多说CSS修改</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#隐藏评论框底部分享到QQ空间按钮"><span class="nav-number">2.1.</span> <span class="nav-text">隐藏评论框底部分享到QQ空间按钮</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#隐藏底部版权信息"><span class="nav-number">2.2.</span> <span class="nav-text">隐藏底部版权信息</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#参考链接"><span class="nav-number">2.3.</span> <span class="nav-text">参考链接</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#搜索功能"><span class="nav-number">3.</span> <span class="nav-text">搜索功能</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#安装hexo-generator-search"><span class="nav-number">3.1.</span> <span class="nav-text">安装hexo-generator-search</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#编辑站点的配置文件，Hexo目录下的-config-yml文件，新增以下内容："><span class="nav-number">3.2.</span> <span class="nav-text">编辑站点的配置文件，Hexo目录下的_config.yml文件，新增以下内容：</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#文章链接唯一化"><span class="nav-number">4.</span> <span class="nav-text">文章链接唯一化</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#文章底部增加版权信息"><span class="nav-number">5.</span> <span class="nav-text">文章底部增加版权信息</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2015 - 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Vitah</span>
</div>



        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      访客
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      
    </span>
  

  
    <span class="site-pv">
      总访问量
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      
    </span>
  
</div>


        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  








  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  


  

    
      <script id="dsq-count-scr" src="https://http-www-vitah-net.disqus.com/count.js" async></script>
    

    
      <script type="text/javascript">
        var disqus_config = function () {
          this.page.url = 'http://www.vitah.net/posts/20f300cc/';
          this.page.identifier = 'posts/20f300cc/';
          this.page.title = 'Hexo Next主题设置和优化';
        };
        var d = document, s = d.createElement('script');
        s.src = 'https://http-www-vitah-net.disqus.com/embed.js';
        s.setAttribute('data-timestamp', '' + +new Date());
        (d.head || d.body).appendChild(s);
      </script>
    

  




	





  





  





  






  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length == 0) {
      search_path = "search.xml";
    }
    var path = "/" + search_path;
    // monitor main search box;

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.popup').toggle();
    }
    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';
      $.ajax({
        url: path,
        dataType: "xml",
        async: true,
        success: function( xmlResponse ) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = $( "entry", xmlResponse ).map(function() {
            return {
              title: $( "title", this ).text(),
              content: $("content",this).text(),
              url: $( "url" , this).text()
            };
          }).get();
          var $input = document.getElementById(search_id);
          var $resultContent = document.getElementById(content_id);
          $input.addEventListener('input', function(){
            var matchcounts = 0;
            var str='<ul class=\"search-result-list\">';
            var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
            $resultContent.innerHTML = "";
            if (this.value.trim().length > 1) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var content_index = [];
                var data_title = data.title.trim().toLowerCase();
                var data_content = data.content.trim().replace(/<[^>]+>/g,"").toLowerCase();
                var data_url = decodeURIComponent(data.url);
                var index_title = -1;
                var index_content = -1;
                var first_occur = -1;
                // only match artiles with not empty titles and contents
                if(data_title != '') {
                  keywords.forEach(function(keyword, i) {
                    index_title = data_title.indexOf(keyword);
                    index_content = data_content.indexOf(keyword);
                    if( index_title >= 0 || index_content >= 0 ){
                      isMatch = true;
                      if (i == 0) {
                        first_occur = index_content;
                      }
                    }

                  });
                }
                // show search results
                if (isMatch) {
                  matchcounts += 1;
                  str += "<li><a href='"+ data_url +"' class='search-result-title'>"+ data_title +"</a>";
                  var content = data.content.trim().replace(/<[^>]+>/g,"");
                  if (first_occur >= 0) {
                    // cut out 100 characters
                    var start = first_occur - 20;
                    var end = first_occur + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if(start == 0){
                      end = 50;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    var match_content = content.substring(start, end);
                    // highlight all keywords
                    keywords.forEach(function(keyword){
                      var regS = new RegExp(keyword, "gi");
                      match_content = match_content.replace(regS, "<b class=\"search-keyword\">"+keyword+"</b>");
                    });

                    str += "<p class=\"search-result\">" + match_content +"...</p>"
                  }
                  str += "</li>";
                }
              })};
            str += "</ul>";
            if (matchcounts == 0) { str = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>' }
            if (keywords == "") { str = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>' }
            $resultContent.innerHTML = str;
          });
          proceedsearch();
        }
      });}

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched == false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(function(e){
      $('.popup').hide();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    });
    $('.popup').click(function(e){
      e.stopPropagation();
    });
  </script>





  

  

  

  

  

</body>
</html>
